////
//// Source code recreated from a .class file by IntelliJ IDEA
//// (powered by FernFlower decompiler)
////
//
//package com.xjrsoft.module.bi.common.tool;
//
//import com.github.qcloudsms.httpclient.DefaultHTTPClient;
//import com.github.qcloudsms.httpclient.HTTPClient;
//import com.github.qcloudsms.httpclient.HTTPException;
//import com.github.qcloudsms.httpclient.HTTPMethod;
//import com.github.qcloudsms.httpclient.HTTPRequest;
//import com.github.qcloudsms.httpclient.HTTPResponse;
//import java.io.IOException;
//import java.net.URISyntaxException;
//import java.util.ArrayList;
//import java.util.Arrays;
//import java.util.Iterator;
//import org.json.JSONException;
//import org.json.JSONObject;
//
//public class SmsMultiSender extends SmsBase {
//    private String url = "https://yun.tim.qq.com/v5/tlssmssvr/sendmultisms2";
//
//    public SmsMultiSender(int appid, String appkey) {
//        super(appid, appkey, new DefaultHTTPClient());
//    }
//
//    public SmsMultiSender(int appid, String appkey, HTTPClient httpclient) {
//        super(appid, appkey, httpclient);
//    }
//
//    public SmsMultiSenderResult send(int type, String nationCode, ArrayList<String> phoneNumbers, String msg, String extend, String ext) throws HTTPException, JSONException, IOException {
//        long random = SmsSenderUtil.getRandom();
//        long now = SmsSenderUtil.getCurrentTime();
//        JSONObject body = new JSONObject();
//        body.put("tel", this.toTel(nationCode, phoneNumbers)).put("type", type).put("msg", msg).put("sig", SmsSenderUtil.calculateSignature(this.appkey, random, now, phoneNumbers)).put("time", now).put("extend", SmsSenderUtil.isNotEmpty(extend) ? extend : "").put("ext", SmsSenderUtil.isNotEmpty(ext) ? ext : "");
//        HTTPRequest req = (new HTTPRequest(HTTPMethod.POST, this.url)).addHeader("Conetent-Type", "application/json").addQueryParameter("sdkappid", this.appid).addQueryParameter("random", random).setConnectionTimeout(60000).setRequestTimeout(60000).setBody(body.toString());
//
//        try {
//            HTTPResponse res = this.httpclient.fetch(req);
//            this.handleError(res);
//            return (new SmsMultiSenderResult()).parseFromHTTPResponse(res);
//        } catch (URISyntaxException var14) {
//            throw new RuntimeException("API url has been modified, current url: " + this.url);
//        }
//    }
//
//    public SmsMultiSenderResult send(int type, String nationCode, String[] phoneNumbers, String msg, String extend, String ext) throws HTTPException, JSONException, IOException {
//        return this.send(type, nationCode, new ArrayList(Arrays.asList(phoneNumbers)), msg, extend, ext);
//    }
//
//    public SmsMultiSenderResult sendWithParam(String nationCode, ArrayList<String> phoneNumbers, int templateId, ArrayList<String> params, String sign, String extend, String ext) throws HTTPException, JSONException, IOException {
//        long random = SmsSenderUtil.getRandom();
//        long now = SmsSenderUtil.getCurrentTime();
//        JSONObject body = (new JSONObject()).put("tel", this.toTel(nationCode, phoneNumbers)).put("sign", sign).put("tpl_id", templateId).put("params", params).put("sig", SmsSenderUtil.calculateSignature(this.appkey, random, now, phoneNumbers)).put("time", now).put("extend", SmsSenderUtil.isNotEmpty(extend) ? extend : "").put("ext", SmsSenderUtil.isNotEmpty(ext) ? ext : "");
//        HTTPRequest req = (new HTTPRequest(HTTPMethod.POST, this.url)).addHeader("Conetent-Type", "application/json").addQueryParameter("sdkappid", this.appid).addQueryParameter("random", random).setConnectionTimeout(60000).setRequestTimeout(60000).setBody(body.toString());
//
//        try {
//            HTTPResponse res = this.httpclient.fetch(req);
//            this.handleError(res);
//            return (new SmsMultiSenderResult()).parseFromHTTPResponse(res);
//        } catch (URISyntaxException var15) {
//            throw new RuntimeException("API url has been modified, current url: " + this.url);
//        }
//    }
//
//    public SmsMultiSenderResult sendWithParam(String nationCode, String[] phoneNumbers, int templateId, String[] params, String sign, String extend, String ext) throws HTTPException, JSONException, IOException {
//        return this.sendWithParam(nationCode, new ArrayList(Arrays.asList(phoneNumbers)), templateId, new ArrayList(Arrays.asList(params)), sign, extend, ext);
//    }
//
//    private ArrayList<JSONObject> toTel(String nationCode, ArrayList<String> phoneNumbers) {
//        ArrayList<JSONObject> phones = new ArrayList();
//        Iterator var4 = phoneNumbers.iterator();
//
//        while(var4.hasNext()) {
//            String phoneNumber = (String)var4.next();
//            JSONObject phone = new JSONObject();
//            phone.put("nationcode", nationCode);
//            phone.put("mobile", phoneNumber);
//            phones.add(phone);
//        }
//
//        return phones;
//    }
//}
